/************************************************************************
                        UserInteractionUnit.h.cpp - Copyright asaf
*/
#include "UserInteractionUnit.h"
#include "Interface.h"
#include "AuthenticationManager.h"
#include "InterfaceLogic.h"

// Ctor/dtor
UserInteractionUnit::UserInteractionUnit(Interface &t_ifc ):m_ifc(t_ifc){}
UserInteractionUnit::~UserInteractionUnit ( ) {}
auto_ptr<Reply> UserInteractionUnit::userRequest (const Request &request)
{
	if (!m_ifc.getDv().validateRequest(request))return new Reply(INVALID_INPUT);//invalid data in request
	if (!(m_ifc.getAm()).checkPermissions(request))return new Reply(NO_PERMISSION);//user does not have permission for this request
	return m_ifc.getIfcl().sendRequest(request);
}